package com.heima.wemedia;

import com.heima.file.service.FileStorageService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;

import java.io.FileInputStream;
import java.io.FileNotFoundException;

@SpringBootTest
public class OssDemo {
    @Autowired
    private FileStorageService fileStorageService;
    @Value("${file.oss.web-site}")
    String webSite;
    @Value("${file.oss.prefix}")
    String prefix;
    @Test
    public void upload() throws FileNotFoundException {
        FileInputStream fileInputStream = new FileInputStream("I:\\sa.JPG");
        String store = fileStorageService.store(prefix, "二次元", fileInputStream);
        System.out.println(webSite+store);
    }
}
